<template>
  <div class="el_main" @click.stop="toDetails(attrs)">
    <div class="el_main_mes">
      <h3 class="el_main_mes_title becomeHand">
        {{ attrs.titleName }}
      </h3>
      <div class="el_main_mes_des" v-html="attrs.pDescribe"></div>
      <div class="el_main_mes_num">
        <div
          class="el_main_mes_num_user becomeHand"
          @click.stop="toMine(attrs)"
        >
          <!-- 头像 -->
          <img :src="attrs.uAvatar" alt="" />
          <!-- 用户昵称 -->
          <span>{{ attrs.nickname }}</span>
        </div>
        <!-- 标签 -->
        <div class="becomeHand">{{ attrs.tName }}</div>
        <!-- 查看数 -->
        <div class="">
          <!-- 图标 -->
          <i class="iconfont icon-chakan deepIcon"></i>
          <!-- 数量 -->
          <span>{{ attrs.viewNums }}</span>
        </div>
        <!-- 回复数 -->
        <div>
          <!-- 图标 -->
          <i class="iconfont icon-xinxi deepIcon"></i>
          <!-- 数量 -->
          <span>{{ attrs.replyNums }}</span>
        </div>
        <!-- 发布时间 -->
        <div>
          <!-- 图标 -->
          <i class="iconfont icon-shijian deepIcon"></i>
          <!-- 数量 -->
          <!-- <span>{{ common.changeTimeFormat(attrs.pTime) }}</span> -->
          <span>{{ attrs.pTime }}</span>
        </div>
      </div>
    </div>
    <img :src="attrs.pImg" alt="" class="el_main_img becomeHand" />
  </div>
</template>
<script>
export default {
  props: {
    attrs: {
      type: Object,
      default () {
        return {}
      }
    }
  },
  data () {
    return {}
  },
  created () {},
  methods: {
    toMine(userMes){
      userMes = JSON.stringify(userMes)
      console.log(userMes)
      this.$router.push({
          path: '/mine',
          query: {
            userMes
          } // 要传递的参数
        })
    },
    toDetails (item) {
      console.log(item)
      let params = item
      console.log(params)
      this.$axios.updatePostView(params).then((res) => {
        console.log(res)
        let detail = JSON.stringify(res.data)
        this.$router.push({
          path: '/details',
          query: {
            detail
          } // 要传递的参数
        })
      })
    }
  }
}
</script>
<style scoped>
.el_main {
  height: 8em;
  display: flex;
  justify-content: space-between;
  margin: 10px 20px;
  padding: 10px 0;
  box-sizing: border-box;
  border-bottom: 1px solid rgb(241, 241, 241);
}
.el_main_mes {
  width: 80%;
  /* height: 90px; */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
  padding-right: 10px;
  background-color: #fff;
}
.el_main_img {
  width: 20%;
  border-radius: 5px;
}
.el_main_mes_title {
  font-weight: 400;
  overflow: hidden; /*超出的文本隐藏*/
  text-overflow: ellipsis; /*溢出用省略号显示*/
  white-space: nowrap; /*溢出不换行*/
}
.el_main_mes_des {
  font-size: 12px;
  color: #a4a5a5;
  overflow: hidden; /*超出的文本隐藏*/
  text-overflow: ellipsis; /*溢出用省略号显示*/
  white-space: nowrap; /*溢出不换行*/
}
.el_main_mes_num {
  display: flex;
  justify-content: space-between;
  padding-right: 50px;
  align-items: center;
  font-size: 12px;
  color: #a4a5a5;
}
.el_main_mes_num > div {
  /* margin-right: 10%; */
}
.el_main_mes_num_user {
  display: flex;
  align-items: center;
}
.el_main_mes_num_user > img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  margin-right: 10px;
}
</style>
